import Vue from "vue"
import vuex from "vuex"
// import createPersistedState from 'vuex-persistedstate'//vuex刷新保持值不变
Vue.use(vuex)
const state = {
  //页头信息
  metaInfo: {
    title: "微服务开发平台" //页面标题
  },
  //登录的用户信息
  userInfo: {},
  imDialog:false,//即时通讯窗口是否显示
  recipient:'',//即时通讯定位到人
  portalItems: [], //多级门户
  defaultPortal: '/layout/homepage', //默认门户
  archiveId: '' //基本信息个人档案Id
}
const mutations = {
  //动态改变页头信息
  changeMetaInfo(state, metaInfo) {
    state.metaInfo = metaInfo
  },
  //（存储）改变登录用户信息
  changeUserInfo(state, userInfo) {
    state.userInfo = userInfo
  },
  //（存储）改变多级门户
  changePortalItems(state, portalItems) {
    state.portalItems = portalItems
  },
  //控制即时通讯聊天窗口是否显示
  changeImDialog(state, imDialog) {
    state.imDialog = imDialog
  },
  //即时通讯定位到人
  changeRecipient(state, recipient) {
    state.recipient = recipient
  },
  changeDefaultPortal(state, defaultPortal) {
    state.defaultPortal = defaultPortal
  },
  //（存储）基本信息个人档案Id
  changeArchiveId(state, archiveId) {
    state.archiveId = archiveId
  }
}
const actions = {}
const getters = {}
export default new vuex.Store({
  state,
  mutations,
  getters,
  actions,
  // plugins: [createPersistedState()]
})
